package homework;

import 力扣热题100.LeetCode16;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class HomeWork9 {
    static class Student implements Cloneable{
        int age;
        String name;

        public Student(int age, String name) {
            this.age = age;
            this.name = name;
        }

        @Override
        protected Object clone() throws CloneNotSupportedException {
            return super.clone();
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Student student = (Student) o;
            return age == student.age && Objects.equals(name, student.name);
        }

        @Override
        public int hashCode() {
            return Objects.hash(age, name);
        }
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        Student student=new Student(20,"wsw");
//        Student student1=(Student) student.clone();
        Student student1=new Student(20,"wsw");
        System.out.println(student1.equals(student));
    }
}
